import 'package:flutter/material.dart';

import '../../../global/extension/int_extension.dart';
import '../models/homo_page_category_model.dart';
import '../../meal_list_page/widgets/meal_list_page.dart';

class YSHHomePageCategoryCell extends StatelessWidget {
  final YSHHomePageCategoryModel _categoryModel;
  const YSHHomePageCategoryCell(this._categoryModel, {super.key}) : super();

  @override
  Widget build(BuildContext context) {
    final bgColor = _categoryModel.cColor ?? Colors.redAccent;
    return GestureDetector(
      onTap: () {
        Navigator.of(context)
            .pushNamed(YSHMealListPage.routeName, arguments: _categoryModel);
      },
      child: Container(
        decoration: BoxDecoration(
            color: bgColor,
            borderRadius: BorderRadius.circular(12.px),
            gradient:
                LinearGradient(colors: [bgColor.withOpacity(0.7), bgColor])),
        alignment: Alignment.center,
        child: Text(
          '${_categoryModel.title}',
          style: const TextStyle(
              fontSize: 16.0,
              fontWeight: FontWeight.bold,
              color: Colors.black87),
        ),
      ),
    );
  }
}
